package com.wz.project.stock.main.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wz.project.stock.main.mapper.BasStockMainMapper;
import com.wz.project.stock.main.domain.BasStockMain;
import com.wz.project.stock.main.service.IBasStockMainService;
import com.wz.common.utils.text.Convert;

/**
 * 主库存Service业务层处理
 * 
 * @author wz
 * @date 2022-12-05
 */
@Service
public class BasStockMainServiceImpl implements IBasStockMainService 
{
    @Autowired
    private BasStockMainMapper basStockMainMapper;

    /**
     * 查询主库存
     * 
     * @param stockId 主库存ID
     * @return 主库存
     */
    @Override
    public BasStockMain selectBasStockMainById(String stockId)
    {
        return basStockMainMapper.selectBasStockMainById(stockId);
    }

    /**
     * 查询主库存列表
     * 
     * @param basStockMain 主库存
     * @return 主库存
     */
    @Override
    public List<BasStockMain> selectBasStockMainList(BasStockMain basStockMain)
    {
        return basStockMainMapper.selectBasStockMainList(basStockMain);
    }

    /**
     * 新增主库存
     * 
     * @param basStockMain 主库存
     * @return 结果
     */
    @Override
    public int insertBasStockMain(BasStockMain basStockMain)
    {
        return basStockMainMapper.insertBasStockMain(basStockMain);
    }

    /**
     * 修改主库存
     * 
     * @param basStockMain 主库存
     * @return 结果
     */
    @Override
    public int updateBasStockMain(BasStockMain basStockMain)
    {
        return basStockMainMapper.updateBasStockMain(basStockMain);
    }

    /**
     * 删除主库存对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBasStockMainByIds(String ids)
    {
        return basStockMainMapper.deleteBasStockMainByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除主库存信息
     * 
     * @param stockId 主库存ID
     * @return 结果
     */
    @Override
    public int deleteBasStockMainById(String stockId)
    {
        return basStockMainMapper.deleteBasStockMainById(stockId);
    }


    //符合条件的可用主库存
    @Override
    public List<BasStockMain> listAbleStockMain(BasStockMain stockMain) {
        List<BasStockMain> list = basStockMainMapper.listAbleStockMain(stockMain);
        return list;
    }

    @Override
    public String selectstockIdBtMainId(String stockMainId) {
        return basStockMainMapper.selectstockIdBtMainId(stockMainId);
    }
}
